home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / BSP Tree Demo / include / arcball.h next >
Encoding:
Text File  |  1995-03-26  |  2.4 KB  |  43 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    arcball.h
  3. //    Date:                    9/18/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the class definition for Ken Shoemake's
  7. //                                ArcBall rotation controller
  8. //                                
  9. //------------------------------------------------------------------------------
  10.  
  11. #include "interface.h"
  12. #include "vector_2d.h"
  13.  
  14. #ifndef ARCBALL
  15. #define ARCBALL
  16.  
  17. //------------------------------------------------------------------------------
  18. //    classes
  19. //------------------------------------------------------------------------------
  20. class    arcball : public interface                                                                                                //    arcball class
  21. {                                                                                                                                                                //    begin arcball definition
  22.     private:                                                                                                                                            //    members internal to this class only
  23.                 void            ComputeArc (short, const vector_3d&, const vector_3d&) const;    //    compute the arc between two points with a given number of segments
  24.                 void            DrawArc (short numsegs) const;                                                                //    draw the arc between the two points
  25.                 vector_3d    MapToSphere (const point_2d &pt);                                                            //    compute the intersection pt of the arcball with a line to the point_3d
  26.     protected:                                                                                                                                        //    members internal to this class hierarchy
  27.                 vector_2d    center;                                                                                                                //    the center point_3d of the arcball
  28.                 real            radius;                                                                                                                //    the radius of the arcball
  29.                 vector_3d    start_vec;                                                                                                        //    the starting vector_3d
  30.                 vector_3d    end_vec;                                                                                                            //    the ending vector_3d;
  31.                 point_2d    start_pt;                                                                                                            //    the start_vec point_3d for the manipulation
  32.                 point_2d    end_pt;                                                                                                                //    the end point_3d of the arc
  33.     public:                                                                                                                                                //    public interface
  34.                 arcball (const point_2d&, real);                                                                                //    normal constructor
  35. virtual    void            Click (const point_2d&);                                                                            //    the first point_3d in the arc
  36. virtual    matrix_3d    Drag (const point_2d&);                                                                                //    the second point_3d in the arc
  37. virtual    void            DrawBackground (void) const;                                                                    //    draw the sphere
  38. virtual    void            DrawForeground (void) const;                                                                    //    draw the arcball interface
  39. };                                                                                                                                                            //    end arcball class definition
  40.  
  41. //------------------------------------------------------------------------------
  42.  
  43. #endif //ARCBALL